﻿using System.Collections.Generic;
using System.Threading.Tasks;

namespace Odyssey.Consul
{
    using Features;
    using Models;
    public interface IAgent
    {
        /// <summary>
        /// 获取Agent集群列表
        /// </summary>
        /// <param name="queryParameter"></param>
        /// <returns></returns>
        Task<List<ResultMember>> ListMembers(QueryParameter queryParameter = null);

        /// <summary>
        /// 读取Agent配置
        /// </summary>
        /// <returns></returns>
        Task<ResultConsulConfiguration> Self();

        /// <summary>
        /// 重新加载Agent配置
        /// </summary>
        /// <returns></returns>
        Task Reload();

        /// <summary>
        /// 启动维护模式
        /// </summary>
        /// <param name="arguEnableMaintenanceMode"></param>
        /// <returns></returns>
        Task EnableMaintenanceMode(ArguEnableMaintenanceMode arguEnableMaintenanceMode);

        /// <summary>
        /// 获取Agent监控信息
        /// </summary>
        /// <returns></returns>
        Task<string> Metrics();

        #region Check
        /// <summary>
        /// 获取校验列表
        /// </summary>
        /// <returns></returns>
        Task<List<ResultCheck>> CheckList();

        Task CheckRegister(ArguCheckRegister arguCheckRegister);

        Task CheckDeregister(string id);

        Task CheckTTLPass(ArguCheckTTL arguCheckTTL);

        Task CheckTTLWarn(ArguCheckTTL arguCheckTTL);

        Task CheckTTLFail(ArguCheckTTL arguCheckTTL);

        Task CheckTTLUpdate(ArguCheckTTLUpdate arguCheckTTLUpdate);
        #endregion

        #region Service
        Task<List<ResultService>> ServiceList();

        Task<ResultService> ServiceConfiguration(string id);

        Task<List<ResultServiceHealth>> ServiceHealth(string id = "", string name = "");

        Task ServiceRegister(ArguServiceRegister arguServiceRegister);

        Task ServiceDeregister(string id);

        Task ServiceEnableMaintenance(ArguServiceEnableMaintenance arguServiceEnableMaintenance);
        #endregion

        #region Connection
        Task<ResultAuthorized> Authorize(ArguAuthorize arguAuthorize);

        Task<ResultCARoots> CARoots();

        Task<ResultServiceLeafCertificate> ServiceLeafCertificate(string serivceName);
        #endregion
    }
}
